#include <cuos/cuos.h>
#include <cuos/detail/pinned_mem_pool.h>

using namespace cuos::host;

int main()
{
  pinned_mem_pool p;
  void *b[100];
  int i=0;

  cuosTrace("before cudaSetDevice()\n");
  cudaSetDevice(0);
  cuosTrace("after cudaSetDevice()\n");

  b[i++] = p.alloc(4096);
  b[i++] = p.alloc(4096);
  b[i++] = p.alloc(245*1024);
  b[i++] = p.alloc(1024*1024);
  b[i++] = p.alloc(245*1024);
  b[i++] = p.alloc(1024*1024);
  b[i++] = p.alloc(1024*1024);
  b[i++] = p.alloc(1024*1024);
  b[i++] = p.alloc(2*1024*1024);
  b[i++] = p.alloc(245*1024);

  for(int j=0; j<i; ++j)
    p.release(b[j]);
}
